package org.yx.service.sbas.view_production_line;

import org.dbist.dml.Page;
import org.dbist.dml.Query;
import org.yx.models.SbasLinDef;
import org.yx.utils.BaseService;

import com.xiaoleilu.hutool.util.StrUtil;

/**
 * 查询生产线
 * @author zxw
 * @since 2018/04/14
**/
public class SbasViewProductionLineService extends BaseService {
	public SbasViewProductionLineOut viewProductionLine(SbasViewProductionLineIn in) throws Exception {
		Query query = new Query(in.getPageIndex(), in.getPageSize());
		query.addFilter("orgCode", in.getUserOrgCode());
		query.addFilter("status", "<>", 'D');
		if (!StrUtil.isBlank(in.getLineCode())) {
			query.addFilter("lineCode", in.getLineCode());
		}
		if (!StrUtil.isBlank(in.getLineType())) {
			query.addFilter("lineType", in.getLineType());
		}
		if (!StrUtil.isBlank(in.getShopCode())) {
			query.addFilter("shopCode", in.getShopCode());
		}

		Page<SbasLinDef> linePage = selectPage(SbasLinDef.class, query);

		SbasViewProductionLineOut out = new SbasViewProductionLineOut();
		out.setLineList(linePage.getList());
		out.setTotalSize(linePage.getTotalSize());

		return out;
	}
}